import 'package:flutter/material.dart';
import 'package:tender_flutter/page/home/model/user_info_entity.dart';
import 'package:tender_flutter/utils/sputils.dart';

class UserProfileInfo with ChangeNotifier {
  UserInfoEntity _userInfo;

  UserProfileInfo(this._userInfo);

  UserInfoEntity get userInfo => _userInfo ?? UserInfoEntity();

  void setUserInfo(UserInfoEntity userInfo) {
    _userInfo = userInfo;
    notifyListeners();
    handle(userInfo);
  }

  handle(UserInfoEntity userInfo) async {
    SPUtils.saveUserInfo(userInfo);
  }
}
